/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.blitzcoder.collide.engine.parser;

import java.util.LinkedList;

/**
 *
 * @author blitzcoder
 */
public abstract class CodeParameterObject extends CodeObject {
    
    private LinkedList<CodeParameter> parameters;
    private String returnType;
    
    public CodeParameterObject(String name,int line,String returnType) {
        super(name,line);
        this.returnType = returnType;
        parameters = new LinkedList<CodeParameter>();
    }
    
    public String getType() {
        return returnType;
    }
    
    public LinkedList<CodeParameter> getParameters() {
        return parameters;
    }
    
    public void addParameter(CodeParameter param) {
        parameters.addLast(param);
    }
    
    public void setParameterList(LinkedList<CodeParameter> list) {
        parameters = list;
    }
    
    public String toString() {
        return super.toString()+":"+getType();
    }

    public boolean equals(Object o) {
        if (o instanceof CodeParameterObject) {
            CodeParameterObject cpo = (CodeParameterObject) o;
            return cpo.getName().equals(getName()) && returnType.equals(cpo.getType()) && parameters.equals(cpo.getParameters());
        }
        return false;
    }
    
}
